//
//  overload_subscript_operate.cpp
//  learnC++
//
//  Created by apple on 2018/6/5.
//  Copyright © 2018年 yunfan.com. All rights reserved.
//

#include "overload_subscript_operate.hpp"

IntList::IntList(int value){
    m_list = new int[value]();
}

IntList::~IntList(){
    delete [] m_list;
}

int& IntList::operator[] (const int index)
{
    //这里可以检测index是否越界
    return m_list[index];
}

const int& IntList::operator[] (const int index) const // for const objects: can only be used for access
{
    return m_list[index];
}
